<?php 
require dirname(__FILE__).'/../Sfilter.php';

$html = <<<HTML
阿扁推翻
HTML;
$socket = new Sfilter(array(
		'server' => '127.0.0.1',
		'port' => 10002,
		'connect_timeout' =>0.001,
		'retry' => 3,
		'read_size' => 1024,
	));
//$socket->add("1&test,2&fast");
$date=0;
$times=1;
$data[]=$html;

if(is_array($data['a']))
{
	foreach($row[$key] as $k=>$val)
	{
		$tmpPre.=$val['name'].",";
	}
}

for($i=0;$i<$times;$i++){
	$sDate=getmilliseconds();

	//$res=$socket->filterHtmls($data);
	$res=$socket->_del($html);
	$res=$socket->filterWords($data);
	var_dump($res);
	$date += getmilliseconds()-$sDate;
}

echo "\n"."times:".$times;
echo "\n"."Average access time:".$date/$times ." ms";

function getmilliseconds() {
	list ($usec, $sec) = explode(" ", microtime());
	return (int)(((float) $usec + (float) $sec) * 1000);
}
?>
